package org.openea.eap.module.obpm.util.form.tableexcel;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.openbpm.base.core.util.StringUtil;
import org.openbpm.bus.api.constant.BusColumnCtrlType;
import org.openbpm.bus.api.model.IBusinessColumn;

























public abstract class BusinessColumnExcellor
{
  abstract BusColumnCtrlType getCtrlType();

  public Object fromExcel(IBusinessColumn column, Object text) {
    if (text == null) {
      return null;
    }

    if (column.getCtrl() == null || StringUtil.isEmpty(column.getCtrl().getConfig())) {
      return text;
    }
    JSONObject config = JSON.parseObject(column.getCtrl().getConfig());
    return fromExcel(column, text, config);
  }





  abstract Object fromExcel(IBusinessColumn paramIBusinessColumn, Object paramObject, JSONObject paramJSONObject);





  public Object toExcel(IBusinessColumn column, Object value) {
    if (value == null) {
      return null;
    }

    if (column.getCtrl() == null || StringUtil.isEmpty(column.getCtrl().getConfig())) {
      return value;
    }
    JSONObject config = JSON.parseObject(column.getCtrl().getConfig());
    return toExcel(column, value, config);
  }

  abstract Object toExcel(IBusinessColumn paramIBusinessColumn, Object paramObject, JSONObject paramJSONObject);
}
